#include "StdAfx.h"
#include "log.h"

/**
 *  Ejemplo Salida: "Texto"
 */
void Log(const std::string& name, const char* str) {
    std::ofstream logFile;
    std::string dir = "C:\\Strategy\\yellow\\";
    dir += name;
    dir += ".txt";

    logFile.open (dir.c_str(), std::ios::out | std::ios::app);
    logFile << str << std::endl;
    logFile.close();
}

/**
 *  Ejemplo Salida: "Texto 1"
 */
void Log(const std::string& name, const char* str, double val) {
    std::ofstream logFile;
    std::string dir = "C:\\Strategy\\yellow\\";
    dir += name;
    dir += ".txt";

    logFile.open (dir.c_str(), std::ios::out | std::ios::app);
    logFile << str << val << std::endl;
    logFile.close();
}

/**
 *  Ejemplo Salida: "Texto (1, 2)"
 */
void Log(const std::string& name, const char* str, double x, double y) {
    std::ofstream logFile;
    std::string dir = "C:\\Strategy\\yellow\\";
    dir += name;
    dir += ".txt";

    logFile.open (dir.c_str(), std::ios::out | std::ios::app);
    logFile << str << " (" << x << ", " << y << ")" << std::endl;
    logFile.close();
}

/**
 *  Ejemplo Salida: "Texto (1, 2)=>(3, 4)"
 */
void Log(const std::string& name, const char* str, double x, double y, double x2, double y2) {
    std::ofstream logFile;
    std::string dir = "C:\\Strategy\\yellow\\";
    dir += name;
    dir += ".txt";

    logFile.open (dir.c_str(), std::ios::out | std::ios::app);
    logFile << str << " (" << x << ", " << y << ") => (" << x2 << ", " << y2 << ")" << std::endl;
    logFile.close();
}
void Log(const std::string& name, const char* str, int whosBall ) {
    std::ofstream logFile;
    std::string dir = "C:\\Strategy\\yellow\\";
    dir += name;
    dir += ".txt";

    logFile.open (dir.c_str(), std::ios::out | std::ios::app);
	if(whosBall == 2)
	{
    logFile << str << "la tienen los amarillos" << std::endl;
    logFile.close();
	}
	
	if(whosBall == 1)
	{
    logFile << str << "la tienen los azules" << std::endl;
    logFile.close();
	}
	if(whosBall == 0)
	{
    logFile << str << "no la tiene nadie" << std::endl;
    logFile.close();
	}
}
